/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.mobiubiq.directory.client.ws;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import org.mobiubiq.directory.client.data.Service;
import org.mobiubiq.directory.client.data.ServiceSettingsRecordStore;
import org.mobiubiq.directory.client.data.Setting;

/**
 *
 * @author Marnix Renne
 */
public class WebServiceAction {

    private String name;
    private Hashtable queryParameters;
    private Hashtable postParameters;

    public WebServiceAction(Service service, String name) {
        super();
        this.name = name;
        queryParameters = new Hashtable();
        postParameters = new Hashtable();
        Vector settings = ServiceSettingsRecordStore.getSettings(service);
        if (settings != null) {
            Enumeration e = settings.elements();
            while (e.hasMoreElements()) {
                Setting setting = (Setting) e.nextElement();
                queryParameters.put(setting.getName(), setting.getValue());
            }
        }
    }

    public void addQueryParameter(String key, String value) {
        queryParameters.put(key, value);
    }

    public void addPostParameter(String key, Object value) {
        postParameters.put(key, value);
    }

    public String getName() {
        return name;
    }

    public Hashtable getQueryParameters() {
        return queryParameters;
    }

    public Hashtable getPostParameters() {
        return postParameters;
    }
}
